﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BLL.Sec
{
    /// <summary>
    /// 节点修改类
    /// </summary>
    public class ModifyNode
    {
        private readonly OracleDAL.Sec.ModifyNode dal = new OracleDAL.Sec.ModifyNode();
        public ModifyNode()
        { }
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string TOTABNAME, string TOCOLNAME, string FROMTABNAME, string FROMCOLNAME)
        {
            return dal.Exists(TOTABNAME, TOCOLNAME, FROMTABNAME, FROMCOLNAME);
        }
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public bool ExistsBYWhere(string strWhere)
        {
            return dal.Exists(strWhere);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.Sec.ModifyNode model)
        {
            return dal.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.Sec.ModifyNode model)
        {
            return dal.Update(model);
        }
       
        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(string TOTABNAME, string TOCOLNAME, string FROMTABNAME, string FROMCOLNAME)
        {

            return dal.Delete(TOTABNAME, TOCOLNAME, FROMTABNAME, FROMCOLNAME);
        }
        /// <summary>
        /// 删除一条数据
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public bool DeleteByWhere(string strWhere)
        {
            return dal.Delete(strWhere);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Sec.ModifyNode GetModel(string TOTABNAME, string TOCOLNAME, string FROMTABNAME, string FROMCOLNAME)
        {

            return dal.GetModel(TOTABNAME, TOCOLNAME, FROMTABNAME, FROMCOLNAME);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Sec.ModifyNode GetModel(string strWhere)
        {
            return dal.GetModel(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.Sec.ModifyNode> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            List<Model.Sec.ModifyNode> modelList = new List<Model.Sec.ModifyNode>();
            int rowsCount = ds.Tables[0].Rows.Count;
            if (rowsCount > 0)
            {
                Model.Sec.ModifyNode model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.Sec.ModifyNode();
                    model.TOTABNAME = ds.Tables[0].Rows[n]["TOTABNAME"].ToString();
                    model.TOCOLNAME = ds.Tables[0].Rows[n]["TOCOLNAME"].ToString();
                    model.FROMTABNAME = ds.Tables[0].Rows[n]["FROMTABNAME"].ToString();
                    model.FROMCOLNAME = ds.Tables[0].Rows[n]["FROMCOLNAME"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }
        /// <summary>
        /// 修改其他表对应的NodeISN
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="toColname"></param>
        /// <param name="OldNodeISN"></param>
        /// <param name="NewNodeISN"></param>
        /// <returns></returns>
        public bool ChangeNodeISN(string tableName, string toColname, string OldNodeISN, string NewNodeISN)
        {
            return dal.ChangeNodeISN(tableName, toColname, OldNodeISN, NewNodeISN);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}
